package cn.javaeye.lonlysky.lforum.web;

import org.apache.struts2.config.ParentPackage;

import cn.javaeye.lonlysky.lforum.ForumBaseAction;
import cn.javaeye.lonlysky.lforum.entity.forum.Usergroups;
import cn.javaeye.lonlysky.lforum.entity.web.Info;
import cn.javaeye.lonlysky.lforum.service.InfoManager;

@ParentPackage("default")
public class InfoViewAction extends ForumBaseAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = 2577660443253126800L;
	private Info info;
	private InfoManager infoManager;
	private Usergroups group;
	
	@Override
	public String execute()  {
		info=infoManager.get(info.getId());
		info.setTimes(String.valueOf(Integer.parseInt(info.getTimes())+1));
		infoManager.save(info);
		group = userGroupManager.getUsergroup(info.getUser().getUsergroups().getGroupid());
		return SUCCESS;
	}

	public Info getInfo() {
		return info;
	}

	public void setInfo(Info info) {
		this.info = info;
	}

	public InfoManager getInfoManager() {
		return infoManager;
	}

	public void setInfoManager(InfoManager infoManager) {
		this.infoManager = infoManager;
	}

	public Usergroups getGroup() {
		return group;
	}

	public void setGroup(Usergroups group) {
		this.group = group;
	}

}
